﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;


namespace IHISCETeim.Web.MachineSys.MacModel
{
    public partial class OFactoryRenovationThreeParty : PageBase
    {
        protected override string DWZRef
        {
            get
            {
                return "OFactoryRenovationList";
            }
        }

        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }


        protected int id
        {
            get
            {

                return GetRequestValue<int>("id", 0);
            }
        }
        private OFactoryRenovationInfo _obj = null;
        protected OFactoryRenovationInfo obj
        {
            get
            {
                if (_obj == null)
                {
                    _obj = OFactoryRenovationController.GetList(id);
                }
                return _obj;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "upload")
            {
                addmenu();
            }
        }
        protected void addmenu()
        {
            string ThreePartyFile = GetRequestValue<string>("ThreePartyFile", "");
            if(!HasPower(Permission.新增))
            {
                AlertJson("对不起，你没有权限上传附件");
                return;
            }
            //  this.AddLog(Permission.新增, null, obj2);

            bool r = OFactoryRenovationController.UpdateThreePartyFile(id, ThreePartyFile);
            if (r)
                SuccessJson("添加文件成功", this.DWZRef);
            else
                ErrorJson("添加文件失败", this.DWZRef);
        }
    }
}